<script setup>
import {ref,reactive,watch} from "vue";

const props = defineProps({
  modelValue: {
    type: Object
  },
  loading: {
    type: Boolean,
    default: false
  }
});
const emit = defineEmits([
  'update:modelValue',
  'search'
]);

const searchFormRef = ref();


function reset() {
  searchFormRef.value.resetFields()
}
function getList(){
  emit('search')
}
watch(() => props.modelValue, (newVal) => {
  emit("update:modelValue", newVal);
})
</script>

<template>
  <el-form ref="searchFormRef" :inline="true" :model="props.modelValue" label-position="left" label-width="100px">
    <el-form-item label="公司名称" prop="company_name">
      <el-input clearable style="width: 220px;" v-model="props.modelValue.company_name" placeholder="请输入公司名称"></el-input>
    </el-form-item>
    <el-form-item label="手机号" prop="mobile">
      <el-input clearable style="width: 220px;" v-model="props.modelValue.mobile" placeholder="请输入手机号"></el-input>
    </el-form-item>
    <el-form-item label="收货手机号" prop="post_mobile">
      <el-input clearable style="width: 220px;" v-model="props.modelValue.post_mobile" placeholder="请输入收货手机号"></el-input>
    </el-form-item>
    <el-form-item label="订单号" prop="order_sn">
      <el-input clearable style="width: 220px;" v-model="props.modelValue.order_sn" placeholder="请输入订单号"></el-input>
    </el-form-item>
    <el-form-item label="开始时间" prop="stime">
      <el-date-picker clearable v-model="props.modelValue.stime" type="datetime" placeholder="请选择"
                      format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />
    </el-form-item>
    <el-form-item label="结束时间" prop="etime">
      <el-date-picker clearable v-model="props.modelValue.etime" type="datetime" placeholder="请选择"
                      format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" />
    </el-form-item>
  </el-form>
  <div>
    <el-button :loading="loading" type="primary" @click="getList()">搜索</el-button>
    <el-button @click="reset()">重置</el-button>
<!--    <el-button :loading="loading" type="primary" @click="exportOrderFn()">导出订单</el-button>-->
  </div>
</template>

<style scoped>

</style>